package com.czd.support.service;

import com.czd.base.service.BaseService;
import com.czd.support.model.Manager;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Author: Jerry.hu
 * Create: Jerry.hu (2014/9/24 23:26)
 * Description: //TODO 文件描述
 * To change this template use File | Settings | File Templates.
 */
@Service
public class ManagerService extends BaseService<Manager> {


	public boolean insert(Manager manager){
		return  this.insertAndReturnId(sqlId("insert"),manager) > 0;
	}
	/**
	 * 根据员工帐号密码，获取员工对象
	 * @return 员工对象
	 */
	public Manager login(String accountCode, String password){
		Map<String,Object> m = new HashMap<>();
		m.put("userCode",accountCode);
		m.put("password",password);
		return this.selectOne(sqlId("login"),m);
	}

	/**
	 * 获取管理员信息列表
	 * @return
	 */
	public List<Manager> queryForList() {
		return this.selectList(sqlId("queryForList"));
	}

	public Manager findById(int id) {
		return this.selectOne(sqlId("findById"),id);
	}
}
